<div class="row">
	<div class="span5">
		<h2>Courses you are taking</h2>
		<table class="table table-bordered table-striped">
			<tbody>
				<?php foreach ($userCoursesTaking as $userCourseTaking) : ?>
				<tr>
					<td class="span4"><?php echo CHtml::encode($userCourseTaking->course->department->name . ' - ' . $userCourseTaking->course->name); ?></td>
					<td><?php echo CHtml::link('Remove', array('/textbooks/profile/removeCourse', 'id'=>$userCourseTaking->id)); ?></td>
				</tr>
				<?php endforeach; ?>
				<tr>
					<td class="span4" colspan="2">
						<?php /** @var BootActiveForm $form */
						$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
							'id' => 'textbook-user-course-taking-form',
							'type' => 'inline',
							'enableAjaxValidation' => true,
							'enableClientValidation' => true,
							'htmlOptions' => array('class'=>'modal-form h-textbooks-course-form-add-course'),
						)); ?>
							<?php echo $form->errorSummary($model); ?>
							<?php echo $form->hiddenField($model, 'type', array('value'=>TextbookUserCourse::TYPE_TAKING)); ?>
							<?php echo $form->dropDownList($model, 'department_id', CMap::mergeArray(array(''=>'[Select one]'), CHtml::listData($departments, 'id', 'name')), array('class'=>'span2 h-textbooks-select-department-id')); ?>
							<?php // echo $form->textFieldRow($model, 'name', array('class'=>'span2')); ?>
							<?php $this->widget('CAutoComplete', array(
								'name' => get_class($model) . '[name]',
								'url' => array('/textbooks/course/suggestCourses'),
								'max' => 10,
								'minChars' => 1,
								'delay' => 500,
								'matchCase' => false,
								'htmlOptions' => array('class'=>'span2 h-textbooks-input-course-name'),
							)); ?>
							<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'plus', 'label'=>'Add course')); ?>
						<?php $this->endWidget(); ?>
					</td>
				</tr>
			</tbody>
		</table>
		
		<h2>Courses you have taken</h2>
		<table class="table table-bordered table-striped">
			<tbody>
				<?php foreach ($userCoursesTaken as $userCourseTaken) : ?>
				<tr>
					<td class="span4"><?php echo CHtml::encode($userCourseTaken->course->department->name . ' - ' . $userCourseTaken->course->name); ?></td>
					<td><?php echo CHtml::link('Remove', array('/textbooks/profile/removeCourse', 'id'=>$userCourseTaken->id)); ?></td>
				</tr>
				<?php endforeach; ?>
				<tr>
					<td class="span4" colspan="2">
						<?php /** @var BootActiveForm $form */
						$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
							'id' => 'textbook-user-course-taken-form',
							'type' => 'inline',
							'enableAjaxValidation' => true,
							'enableClientValidation' => true,
							'htmlOptions' => array('class'=>'modal-form h-textbooks-course-form-add-course'),
						)); ?>
							<?php echo $form->errorSummary($model); ?>
							<?php echo $form->hiddenField($model, 'type', array('value'=>TextbookUserCourse::TYPE_TAKEN)); ?>
							<?php echo $form->dropDownList($model, 'department_id', CMap::mergeArray(array(''=>'[Select one]'), CHtml::listData($departments, 'id', 'name')), array('class'=>'span2 h-textbooks-select-department-id')); ?>
							<?php // echo $form->textFieldRow($model, 'name', array('class'=>'span2')); ?>
							<?php $this->widget('CAutoComplete', array(
								'name' => get_class($model) . '[name]',
								'url' => array('/textbooks/course/suggestCourses'),
								'max' => 10,
								'minChars' => 1,
								'delay' => 500,
								'matchCase' => false,
								'htmlOptions' => array('class'=>'span2 h-textbooks-input-course-name'),
							)); ?>
							<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'plus', 'label'=>'Add course')); ?>
						<?php $this->endWidget(); ?>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
